from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QLabel, QLineEdit
from PyQt5.QtCore import Qt

class SimpleGUI(QWidget):
    def __init__(self):
        super().__init__()

        self.init_ui()

    def init_ui(self):
        self.setWindowTitle("简单图形界面")

        button = QPushButton("点击我", self)
        button.clicked.connect(self.on_click)
        button.resize(button.sizeHint())
        button.move(50, 50)

        label = QLabel("这是一个标签", self)
        label.setAlignment(Qt.AlignCenter)
        label.resize(label.sizeHint())
        label.move(50, 100)

        text = QLineEdit(self)
        text.resize(text.sizeHint())
        text.move(50, 150)

        self.show()

    def on_click(self):
        print("按钮被点击了，文本框内容为：", text.text())

if __name__ == "__main__":
    app = QApplication([])
    gui = SimpleGUI()
    app.exec_()
